// import viteImagemin from 'vite-plugin-imagemin'

// export default function createImageCompression(env: Record<string, string>) {
//     const plugins: any[] = [];
//     const { VITE_BUILD_IMAGE_COMPRESS } = env
//     const compressList = VITE_BUILD_IMAGE_COMPRESS.split(',')
//     if (compressList.includes('true')) {
//         plugins.push(
//             viteImagemin({
//                 gifsicle: { optimizationLevel: 7 },
//                 optipng: { optimizationLevel: 7 },
//                 mozjpeg: { quality: 80 },
//                 pngquant: { quality: [0.8, 0.9], speed: 4 },
//                 svgo: { plugins: [{ removeViewBox: false }] }
//             })
//         );
//     }

//     return plugins;
// }